package net.monare.mifss.admin.ui.win;

import com.vaadin.ui.NativeButton;
import com.vaadin.ui.VerticalLayout;
import com.vaadin.ui.Window;
import com.vaadin.ui.themes.Runo;
import net.monare.mifss.MifssMessages;
import net.monare.mifss.admin.ui.mod.StorageSetDefUiModule;
import net.monare.mifss.configurations.pojo.StorageSetDef;
import net.monare.mifss.evn.AddNewStorageSetListener;

/**
 * Created by jernej on 4/9/14.
 */
public class AddNewStorageSetWindow extends Window {

    private StorageSetDefUiModule storageSetDefUiModule;

    public AddNewStorageSetWindow(ConfigureStorageWindow parent){

        setCaption(MifssMessages.getMessage("title.add.storage.set"));
        setStyleName(Runo.WINDOW_DIALOG);
        setWidth("550px");
        setHeight("350px");
        setModal(true);

        VerticalLayout windowLayout = new VerticalLayout();
        windowLayout.setMargin(true);
        windowLayout.setSpacing(true);

        storageSetDefUiModule = new StorageSetDefUiModule();

        // add title

        windowLayout.addComponent(storageSetDefUiModule);


        // add button
        NativeButton addStorageSetDef = new NativeButton("add new storage set");
        AddNewStorageSetListener addNewStorageSetListener = new AddNewStorageSetListener(parent, this);
        addStorageSetDef.addClickListener(addNewStorageSetListener);
        windowLayout.addComponent(addStorageSetDef);
        setContent(windowLayout);

    }

    public StorageSetDef getStorageSetDef(){
        return storageSetDefUiModule.getStorageSetDef();
    }

}
